Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: fix broken internal links and ensure they stay fixed #7695

Merged
merged 9 commits into from
Apr 2, 2024

Conversation

SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Mar 28, 2024

Motivation and context

We have quite a few broken links, which is unsurprising, as Hugo does not help detect them.

This patch adds a custom shortcode (ilink) which validates the target path and then renders as a link. It rewrites most internal links to use this shortcode, and fixes those which were broken.

Originally, I was just going to use the builtin relref shortcode to build the URLs, but it turns out that that does not play well with remark. It becomes confused and thinks you forgot to specify the URL altogether. ilink replaces the entire link, so remark has nothing to complain about. ilink supports a default link text, although I haven't yet used this anywhere.

I also "fortified" the "about" link in navbar.html, although templates don't support shortcodes, so I just used the relref function.

A few links I had to keep as-is for various reasons:

  • Links from the docs/_index.md, because they are inside a shortcode, and as far as I can tell, you can't put shortcodes in shortcode parameters.
  • The refresh URLs in home.html and 404.html, for complicated reasons.
  • Links to autogenerated API documentation pages due to some known problems with generating those pages for previous releases.

Finally, I had to update build_docs.py, because it neglected to check out page_404.html when rendering the docs for previous versions, and the new version of page_404.html will not render without the new shortcode.

How has this been tested?

hugo --destination ../public/cvat --config config.toml

Checklist

  • I submit my changes into the develop branch
  • [ ] I have created a changelog fragment
  • I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues (see GitHub docs)
  • [ ] I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@SpecLad SpecLad requested a review from mdacoca as a code owner March 28, 2024 16:53
@SpecLad
Copy link
Contributor Author

SpecLad commented Mar 28, 2024

Bleh. Doesn't seem like there's a way to fix the Remark problems easily. :/ I'll close this for now.

@SpecLad SpecLad closed this Mar 28, 2024
@SpecLad SpecLad reopened this Mar 29, 2024
@SpecLad SpecLad marked this pull request as draft March 29, 2024 15:46
@SpecLad SpecLad changed the title Docs: replace most internal links with Hugo references Docs: fix broken internal links and ensure they stay fixed Mar 29, 2024
@SpecLad SpecLad marked this pull request as ready for review March 29, 2024 17:45
@SpecLad SpecLad requested a review from zhiltsov-max March 29, 2024 17:45
@SpecLad
Copy link
Contributor Author

SpecLad commented Mar 29, 2024

@mdacoca Could you review and make sure I redirected the broken links to the correct pages? Those fixes are all in the second commit.

@SpecLad SpecLad merged commit 73c7081 into cvat-ai:develop Apr 2, 2024
14 checks passed
@SpecLad SpecLad deleted the relref branch April 2, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants